/**
 * Created by chenkeliang on 2017/3/8.
 */
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');


new WebpackDevServer(webpack(config), {
    publicPath: config.output.publicPath,
    hot: true,
    historyApiFallback: true,
    proxy: [{
        context: ['/**', '!/static/**', '!/webpack/**', '!/webpack-dev-server/**', '!/sockjs-node/**', '!/index.html'],
        target: 'http://tstmanage.360kad.com',
        changeOrigin: true
    }]
}).listen(7000, 'localhost', function (err, result) {
    if (err) {
        console.log(err);
    }

    console.log('Listening at localhost:7000');
    console.log('输入账号密码后,使用这个地址:http://127.0.0.1:7000/index.html');
    console.log('如果需要动态端口则在package.json的script节点加上这句话:')
    console.log('"dev": "webpack-dev-server --hot --history-api-fallback --open"')

});
